#include <time.h>	// random
#include "OpenglWindow.h"
#include "ImageLoader.h"
#include "TetrisBlok.h"
//#include "Blok.h"

enum {
	DEBUG_ALL = 0,
	DEBUG_CRITICAL,
	DEBUG_NONE
};
LRESULT windowHandler(HWND, UINT, WPARAM, LPARAM);

class Tetris 
{
private:
	//-VARS----------------------
	unsigned int	frames;
	int				debugMode;
	bool			quit;
	TetrisBlok		tblokken[50];
	TetrisBlok		*activeBlok;
	int				numBlocks;

	//-FUNCS---------------------
	void			render();
	void			draw3D();
	void			draw2D();
	void			createNewBlok();
	int				random(int max);
	bool			loadTextures();
	GLuint			loadTexture(Image* image);

	void reflectiontest();
	void drawFloor();


	//-TESTFUNCs-----------------
	void			draw3DGrid();
	void			drawTest();
	bool		collisionDetect(bool a, bool b);
	

public:
	OpenglWindow	*window;
	void			tick();
	GLuint			texture[1];
	
	Tetris();
	Tetris(int test);
	~Tetris();

	void destroy();

	void setDebugMode(int mode);
	void			keyPress(int key, bool down);
	void mainLoop();
};